package com.csyf.manager.utils;

import java.util.Map;
import java.util.Set;

/**
 * @Author: Enzo
 * @Date: 2019/1/11 11:59
 */
public class HtmlUtils {


    public static String submitForm(String pay_url, Map map) {
        StringBuffer formhtml = new StringBuffer();
        formhtml.append("<form action=\"" + pay_url + "\" method=\"post\">");
        Set<Map.Entry<String, String>> entries = map.entrySet();
        for (Map.Entry<String, String> entry : entries) {
            formhtml.append(String.format("<input type=\"hidden\"  name = \"%s\" value=\"%s\" /> \n",entry.getKey(),entry.getValue()));
        }
        formhtml.append("</form>");
        System.out.println(formhtml);
        return formhtml.toString();
    }
}
